<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" type="text/css"
	href="../resources/admin/css/header.css">
<link rel="stylesheet" type="text/css"
	href="../resources/admin/css/criclemenu.css">
<link rel="stylesheet" type="text/css"
	href="../resources/admin/css/add-category.css">
<link rel="stylesheet" type="text/css"
	href="../resources/admin/css/category.css">

<script src="../resources/admin/js/html2xhtml.min.js"></script>
<script src="../resources/admin/js/richtext.js"></script>
<script language="JavaScript" type="text/javascript">
<!--
	function submitForm() {
		//make sure hidden and iframe values are in sync for all rtes before submitting form
		updateRTEs();

		//change the following line to true to submit form
		alert("rte1 = " + (document.RTEDemo.rte1.value));
		return false;
	}
	//Usage: initRTE(imagesPath, includesPath, cssFile, genXHTML, encHTML)
	initRTE("../resources/admin/js/images/", "../resources/admin/js/", "", true);
//-->
</script>
</head>
<body onload="myFunction()">

	<br></br>

	<form:form method="POST" action="saveProduct.html">
		<div class="CSSTableGenerator">
			<div>
				<form:label path="productId">Mã Sản Phâm: </form:label>
				<form:input path="productId" value="${product.productId}"
					readonly="true" style="margin-left: 200px" />
				<hr width="100%">
			</div>

			<div>
				<form:label path="productName">Tên Sản Phẩm: </form:label>
				<form:input path="productName" value="${product.productName}"
					style="margin-left: 190px" />
				<hr width="100%">
			</div>

			<div>
				<form:label path="tag">Từ Khóa: </form:label>
				<form:input path="tag" value="${product.tag}"
					style="margin-left: 240px" />
				<hr width="100%">
			</div>

			<div>
				<form:label path="description">Mô Tả: </form:label>
				<form:input path="description" value="${product.description}"
					style="margin-left: 255px" />
					
					<div style="margin-left: 235px">
					<script language="JavaScript" type="text/javascript">
					<!--
						//build new richTextEditor
						var rte1 = new richTextEditor('rte1');
						rte1.html = '';

						//enable all commands for demo
						rte1.cmdFormatBlock = true;
						rte1.cmdFontName = true;
						rte1.cmdFontSize = true;
						rte1.cmdIncreaseFontSize = true;
						rte1.cmdDecreaseFontSize = true;

						rte1.cmdBold = true;
						rte1.cmdItalic = true;
						rte1.cmdUnderline = true;
						rte1.cmdStrikethrough = true;
						rte1.cmdSuperscript = true;
						rte1.cmdSubscript = true;

						rte1.cmdJustifyLeft = true;
						rte1.cmdJustifyCenter = true;
						rte1.cmdJustifyRight = true;
						rte1.cmdJustifyFull = true;

						rte1.cmdInsertHorizontalRule = true;
						rte1.cmdInsertOrderedList = true;
						rte1.cmdInsertUnorderedList = true;

						rte1.cmdOutdent = true;
						rte1.cmdIndent = true;
						rte1.cmdForeColor = true;
						rte1.cmdHiliteColor = true;
						rte1.cmdInsertLink = true;
						rte1.cmdInsertImage = true;
						rte1.cmdInsertSpecialChars = true;
						rte1.cmdInsertTable = true;
						rte1.cmdSpellcheck = true;

						rte1.cmdCut = true;
						rte1.cmdCopy = true;
						rte1.cmdPaste = true;
						rte1.cmdUndo = true;
						rte1.cmdRedo = true;
						rte1.cmdRemoveFormat = true;
						rte1.cmdUnlink = true;

						//rte1.toggleSrc = false;

						rte1.build();
						
					//-->
					</script>
					
				</div>
				<hr width="100%">
			</div>

			<div>
				<form:label path="detailInfo">Chi Tiết: </form:label>
				<form:input path="detailInfo" value="${product.detailInfo}"
					style="margin-left: 245px" />
				<hr width="100%">
			</div>

			<div>
				<form:label path="status">Trạng Thái: </form:label>
				<form:input path="status" value="${product.status}"
					style="margin-left: 220px" />
				<hr width="100%">
			</div>


			<div>
				<form:label path="categories">Category: </form:label>
				<br /> <br />

				<c:forEach var="cate" items="${categories}">
					<form:checkbox path="categories" value="${cate.categoryId}"
						style="margin-left: 230px" />${cate.categoryName} 
						<br />
					</c:forEach>				


				<hr width="100%">
			</div>

			<div>
				<form:label path="dateCreate">Ngày Tạo: </form:label>
				<form:input path="dateCreate" type="date" id="myDate"
					style="margin-left: 230px"></form:input>

				<hr width="100%">
				<script type="text/javascript">
					function myFunction() {
						document.getElementById("myDate").value = "${date}";
					}
				</script>

			</div>

		</div>

		<input type="submit" value="Lưu" class="button"
			style="margin-top: 30px; margin-left: 150px;" />
		<input type="hidden" name="${_csrf.parameterName}"
			value="${_csrf.token}" />
	</form:form>
</body>
